package edu.jhu.cs.oose.scheduleit.util;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
 * The class is used to be a container for all attributes while creating
 * new VO object, for example, Schedule, User, Event
 * @author JHYU
 *
 */
public class Attribute {
	/**
	 * The attributes of certain VO object
	 */
	private Map<Enum<?>,Object> attributes;
	
	/**
	 * Constructor of this class
	 */
	public Attribute(){
		this.attributes = new HashMap<Enum<?>, Object>();
	}
	
	/**
	 * Add a new attribute for VO object
	 * @param attributeKind	The key of the new attribute
	 * @param value	The value of the new attribute
	 * @return	The previous value with the same key
	 */
	public Object put(Enum<?> attributeKind, Object value){
		return this.attributes.put(attributeKind, value);
	}
	
	/**
	 * Remove an attribute from VO object
	 * @param attributeKind	The key of the removed attribute
	 * @return	The value of the removed event
	 */
	public Object remove(Enum<?> attributeKind){
		return this.attributes.remove(attributeKind);
	}
	
	/**
	 * The getter for keys of attributes
	 * @return
	 */
	public Set<Enum<?>> getAttributeKinds(){
		return this.attributes.keySet();
	}
	
	/**
	 * The getter for value of a certain attribute key
	 * @param attribute
	 * @return
	 */
	public Object getValue(Enum<?> attribute){
		return this.attributes.get(attribute);
	}
}
